//
//  WHReconizeInfoView.m
//  SquirrelSeller
//
//  Created by 邓伟浩 on 2019/1/8.
//  Copyright © 2019 邓伟浩. All rights reserved.
//

#import "WHReconizeInfoView.h"

@interface WHReconizeInfoView ()

@property (nonatomic, strong) UIView *selectExpressBackView;
@property (nonatomic, strong) UIImageView *rightImageView;
@property (nonatomic, strong) UIButton *confirmBtn;
@property (nonatomic, strong) UIButton *storeInBtn;

@end

@implementation WHReconizeInfoView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = KWhiteColor;
        [self setUpInfoView];
    }
    return self;
}

- (void)setUpInfoView {
    [self addSubview:({
        _selectExpressBackView = [[UIView alloc] init];
        _selectExpressBackView;
    })];
    [_selectExpressBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self);
        make.height.mas_equalTo(kRealwidth(55));
    }];
    
    [self.selectExpressBackView addSubview:({
        _expressNameLabel = [[UILabel alloc] init];
        _expressNameLabel.textAlignment = NSTextAlignmentLeft;
        _expressNameLabel.font = SYSTEMFONT(kRealwidth(16));
        _expressNameLabel.textColor = CFontTitleBlackColor;
        _expressNameLabel;
        
    })];
    
    [_expressNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.selectExpressBackView.mas_left).offset(kRealwidth(15));
        make.centerY.mas_equalTo(self.selectExpressBackView.mas_centerY);
        make.height.mas_equalTo(kRealwidth(40));
    }];
    
    [self.selectExpressBackView addSubview:({
        _rightImageView = [[UIImageView alloc] init];
        _rightImageView.contentMode = UIViewContentModeScaleAspectFit;
        _rightImageView.image = IMAGE_NAMED(@"icon_tips_right");
        _rightImageView;
    })];
    
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.selectExpressBackView.mas_right).offset(-kRealwidth(15));
        make.width.mas_equalTo(kRealwidth(8));
        make.height.mas_equalTo(kRealwidth(14));
        make.centerY.mas_equalTo(self.selectExpressBackView.mas_centerY);
    }];
    
    [self.selectExpressBackView addSubview:({
        _courierLabel = [[UILabel alloc] init];
        _courierLabel.textAlignment = NSTextAlignmentRight;
        _courierLabel.font = SYSTEMFONT(kRealwidth(16));
        _courierLabel.textColor = CFontTitleBlackColor;
        _courierLabel;
        
    })];
    
    [_courierLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_rightImageView.mas_left).offset(-kRealwidth(15));
        make.centerY.mas_equalTo(self.selectExpressBackView.mas_centerY);
        make.height.mas_equalTo(kRealwidth(40));
    }];
    
    UITapGestureRecognizer *tapGes = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(select:)];
    [_selectExpressBackView addGestureRecognizer:tapGes];
}

- (void)select:(UITapGestureRecognizer *)tapGes {
    if (self.selectExpress) {
        self.selectExpress();
    }
}

@end

